using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace ServiceBroker
{
    public class Worker : BackgroundService
    {
        private readonly ILogger<Worker> _logger;
        private readonly sqlDependency _sqlDependency;

        public Worker(ILogger<Worker> logger, sqlDependency sqlDependency)
        {
            _logger = logger;
            _sqlDependency = sqlDependency;
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            _sqlDependency.init();
            _sqlDependency.Update();
        }
    }
}
